<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/7/20
 * Time: 8:55
 */

namespace App\Model;
use Illuminate\Database\Eloquent\Model;

class Notice extends Model
{
    protected $table = 'notice';
    protected $fillable = [
        'id',
        'notice_name',
        'content',
        'release_time',
        'deadline',
        'is_publish',
        'created_at',
        'updated_at'
    ];
    /*
     * 获取全部公告
     */
    public function getAll(){
        $notice = $this->get()->toArray();
        if ($notice){
            return $notice;
        } else {
            return false;
        }
    }

    /*
     * 获取单条公告
     */
    public function getOne( $id ){
        $notice = $this->where('id',$id)->first();
        if ($notice){
            return $notice;
        } else {
            return false;
        }
    }
}